import axios from "../utils/request.js"
import base from "../api/base.ts"
import qs from "querystring"

const api = {
    /**
     * 获取首页Banner 
     */
    getHomeBanner() {
        return axios.get(base.baseUrl + base.homeBanner)
    },
    /**
     * 获取最新商品
     */
    getNewGoods() {
        return axios.get(base.baseUrl + base.newGoods)
    },
    /**
     * 获取推荐商品
     */
    getRecommendGoods() {
        return axios.get(base.baseUrl + base.recommendGoods)
    },
    /**
     * 获取人才库
     */
    getPersonStore() {
        return axios.get(base.baseUrl + base.personStore)
    },
    /**
     * 美业咨询分页
     */
    getBeauty(params: any) {
        return axios.get(base.baseUrl + base.beauty, {
            params
        })
    },
    /**
     * 选址
     */
    getPlace(params: any) {
        return axios.get(base.baseUrl + base.place, {
            params
        })
    },
    /**
     * 精选
     */
    getSuit() {
        return axios.get(base.baseUrl + base.suit)
    },
    /**
     * 人才页面
     */
    getPersonList(params: any) {
        return axios.get(base.baseUrl + base.personList, {
            params
        })
    },
    /**
     * 人才详情页
     */
    getPersonDetails(params: Object) {
        return axios.get(base.baseUrl + base.personDetails, {
            params
        })
    },
    /**
     * 获取全部订单
     */
    getOrderAll() {
        return axios.get(base.baseUrl + base.orderAll)
    },
    /**
     * 订单类型
     */
    getOrderType(params: Object) {
        return axios.get(base.baseUrl + base.orderType, {
            params
        })
    },
    /**
     * 订单类型
     */
    getPlaceDetails(params: Object) {
        return axios.get(base.baseUrl + base.placeDetails, {
            params
        })
    },
    /**
     * 商品详情
     */
    getGoodsDetails(params: Object) {
        return axios.get(base.baseUrl + base.goodsDetails, {
            params
        })
    },
    /**
    * 商品评价
    */
    getCommentGoods(params: Object) {
        return axios.get(base.baseUrl + base.commentGoods, {
            params
        })
    },
    /**
    * 全部评价
    */
    getCommentAll() {
        return axios.get(base.baseUrl + base.commentAll)
    },
    /**
     * 登录
     */
    getLogin(params: Object){
        return axios.post(base.baseUrl + base.login,qs.stringify(params as any))
    },
    /**
     * 注册
     */
    getRegister(params:Object){
        return axios.post(base.baseUrl + base.register,qs.stringify(params as any))
    },
    /**
     * 创建订单
     */
    getCreateOrder(params:Object){
        return axios.post(base.payBase + base.createOrder,params)
    },
    /**
     * 订单付款
     */
    getPayOrder({ orderNo }:any){
        return axios.post(base.payBase + base.payOrder + orderNo)
    }
}

export default api
